from tqdm import tqdm
import concurrent.futures as cf
import time

date1 = '(_)'

def get_allurl(urli,date1):
    time.sleep(1)
    return urli + date1

def processpool1():
    with tqdm(iterable=range(1000), desc='页数解析', unit='页', total=1000, leave=True) as pgbr:
        # with alive_bar(title='页数解析', bar='filling', spinner='waves', total=pages-1) as pgbr:
        # with cf.ThreadPoolExecutor() as p: # 线程池
        with cf.ProcessPoolExecutor() as p: # 进程池
            for i in range(1000):
                x = p.submit(get_allurl, i, date1).add_done_callback(lambda func: pgbr.update(1))
                # print(x)
                # print('页数解析：',i)
                # p.submit(get_allurl, urli).add_done_callback(lambda func: pgbr())
                pass

if __name__ == '__main__':
    processpool1()